function POST(url,data,callback){
var request=new XMLHttpRequest();
request.onreadystatechange=function(){
    if(request.readyState===4&&request.status===200){
        callback(request.responseText);
    }
}
request.open("POST",url);
request.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=utf-8");
var form='';
for(var key in data){    
    form+=key+"="+data[key]+"&";    
}
form=form.substring(0,form.length-1);
request.send(form);
}
function GET(url,callback){
    var request=new XMLHttpRequest();
    request.onreadystatechange=function(){
        if(request.readyState===4&&request.status===200){
            callback(request.responseText);
        }
    }
    request.open("GET",url);
    request.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=utf-8");   
    request.send(null);
}

function GET1(url,data,callback){
    var query='';
    for(var key in data){
        query+=key+'='+data[key]+'&';
    }
    var request=new XMLHttpRequest();
    request.onreadystatechange=function(){
        if(request.readyState===4&&request.status===200){
            callback(request.responseText);
        }
    }
    request.open("GET",url+'?'+query.substring(0,query.length-1));
    request.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=utf-8");   
    request.send(null);
}

export default{
    POST,
    GET,
    GET1
}